
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
  
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-block">
                <select name="type" lay-verify="required" lay-filter="qwe" class="layui-input">
                    <option value="">--请选择--</option>
                    <option value="1" {if condition="$row.type eq 1"}selected{/if}>顶部轮播图</option>
                    <option value="2" {if condition="$row.type eq 2"}selected{/if}>中部轮播图</option>
                    <option value="3" {if condition="$row.type eq 3"}selected{/if}>一级分类图</option>
                    <option value="4" {if condition="$row.type eq 4"}selected{/if}>分销海报图</option>
                </select>
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label required">图片</label>
            <div class="layui-input-block layuimini-upload">
                <input name="image" class="layui-input layui-col-xs6" readonly  placeholder="请上传图片" value="{$row.img|default=''}">
                <div class="layuimini-upload-btn">
                    <span><a class="layui-btn" data-upload="image" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
                </div>
            </div>
        </div>
        <div class="layui-form-item" id="img1">
            <label class="layui-form-label">轮播图url</label>
            <div class="layui-input-block">
                <input type="text" name="imgurl" class="layui-input" placeholder="请输入小程序端路由" value="{$row.imgurl|default=''}">
                <tip>请输入小程序端路由</tip>
            </div>
        </div>
        <input type="hidden" id="type" value="{$row.type}">
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>
    </form>
</div>
<script type="text/javascript">
    layui.use(['form','upload'], function(){
        var form = layui.form;
        var upload = layui.upload;
        $ = layui.$;
        type =  $("#type").val()
        if(type == 1 || type == 2){
            $("#img1").show();
        }else{
            $("#img1").hide();
        }
        form.on('select(qwe)', function(data){
            var level = data.value;//被点击的radio的value值
            //TODO 下面是我具体业务的处理代码，可忽略 ...
            if(level == 1 || level == 2){
                $("#img1").show();
            }else{
                $("#img1").hide();
            }
        });

    });
</script>